###############################
# Analysis of survey data 
###############################

rm(list=ls())

sink("003_survey_analysis.txt")

# load packages 
library(foreign)
library(lmtest)
library(sandwich)
library(stargazer)
library(msm)
library(Hmisc)

##############################
# Check data
##############################

# load data
d <- read.dta("survey_Romania.dta")
head(d)
names(d)
dim(d)

# attach data
d$highschool = 0
d$female = 0
attach(d)

# APPENDIX B
# Female
# (Gender; 1:male, 2:female)
female[gender==2]=1
round(mean(female),2)

# Age
round(median(d$age),2)

# High school
# (Education; 1:No school,2:Primary,3:Middle school,4:Professional school,5:High School,6:Post-secondary school,7:College and graduate school) 
highschool[education>4]=1
round(mean(highschool),2)

# Rural
# (1:urban, 0:rural)
round(1 - mean(urban),2)

sink()
  